package gradle.rabbit.common.properties;

import lombok.Data;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

/**
 * 首选配置
 */
@Data
@RefreshScope
@Configuration
@ConditionalOnClass(value = ConnectionFactory.class)
public class PrimaryRabbitProperty {

    /**
     * 地址
     */
    @Value("${spring.rabbitmq.primary.addresses}")
    private String addresses;

    /**
     * 用户名
     */
    @Value("${spring.rabbitmq.primary.username}")
    private String username;

    /**
     * 密码
     */
    @Value("${spring.rabbitmq.primary.password}")
    private String password;

    /**
     * 虚拟主机
     */
    @Value("${spring.rabbitmq.primary.virtual-host}")
    private String virtualHost;

    /**
     * 超时时间
     */
    @Value("${spring.rabbitmq.primary.connection-timeout}")
    private Integer connectionTimeout;

    /**
     * 是否启用重试
     */
    @Value("${spring.rabbitmq.primary.template.retry.enabled:false}")
    private boolean templateRetryEnabled;

    /**
     * 是否启用SSL加密
     */
    @Value("${spring.rabbitmq.primary.ssl.enabled:false}")
    private boolean sslEnabled;

    /**
     * SSL虚拟主机
     */
    @Value("${spring.rabbitmq.primary.ssl.verify-hostname:false}")
    private boolean sslVerifyHostname;

    /**
     * SSL验证
     */
    @Value("${spring.rabbitmq.primary.ssl.validate-server-certificate:false}")
    private boolean sslValidateServerCertificate;
}
